class Person {
  constructor() {
    this.queue = Promise.resolve()
  }
  eat(something) {
    this.queue = this.queue.then(() => {
      console.log(something);
      return Promise.resolve()
    })
    return this
  }
  sleep(delay) {
    this.queue = this.queue.then(() => {
      return new Promise(resolve => setTimeout(resolve, delay))
    })
    return this
  }
}